<extend name="Base/common"/>
        <block name="style">
		<link rel="stylesheet" type="text/css" href="/Application/Home/Common/css/go.css"/>
		<link rel="stylesheet" type="text/css" href="/Application/Home/Common/css/2.css"/>

		</block>
		<block name="header"></block>
	         <block name="main">
			<!--图片-->
			<div class="full_sc order_bottom">
				<div class="w1200 header_conter ">
					<div class="h_c_logo">
	    			    <a href="index.html">
	    				    <img src="/Application/Home/Common/image/logo.jpg"/>
	    			    </a>
	    		    </div>
	    		    <div class="h_c_right">
	    		    	<div class="order_Status"></div>
	    		    </div>
				</div>
			</div>
			<!--end-->
		</div>
		<!--tip-->
		<div class="public_b">
			<div class="w1200">
				<div id="main">
					<div class="w930 m0a mt30">
						<div class="ml20">
							<b class="f16">购物车：</b>
							<if condition="is_login()">
							      <a id="login_now" href="{:U('Index/index')}" class="cd00 ul fancybox.iframe">回到首页</a>
							<else />
							  
							  <a id="login_now" href="{:U('User/login')}" class="cd00 ul fancybox.iframe">现在登录</a>
                            
							<span class="c999">购物车信息将一直为您保存</span>
							</if>
						</div>
						
						<div class="bgf6f br10">
							<ul class="c999 f13 h40 mt10 li_left">
								<!-- <li class="row-selected row-selected"><input class="check-all" type="checkbox"/></li> -->                    
								<li class="w510 tl pl20">商品</li>
								<li class="">属性</li>
								<li class="w120 tc" style="margin-left: 45px">售价</li>
								<li class="w120 tc">数量</li>
								<li class="w80 tr pr64" >操作<input class="check-all checkbox_all" type="checkbox"></li>
							</ul>
                             <input type="hidden" name="id" value="{$vo.id}">

                           <form action="{:U('Car/submitpath')}" method="post">
							<ul class="bt_1_eae bb_1_fff" id="goods_line_548546"></ul>
							<volist name="car" id="vo">
							<ul class="999 f13 h120 li_left" id="goods_list_548546">
								<li class="w510 tl pl20">
									<a href="{:U('Index/iemt',array('gid'=>$vo['gid']))}" target="_blank" class="fl">
										<img src="/Uploads/{$vo.pic}" width="100px" height="100px" class="m_10_20_10_0" alt="">
									</a>
									<a href="{:U('Index/iemt',array('gid'=>$vo['gid']))}" target="_blank">
									   
										<span class="bold c333 fl h20 mt35">{$vo.name}</span>
									</a>
								</li>
								<li class="w120 ">
									<span class="bold ccf0 f16">{$vo.attrvid}</span>
								</li>
								<li class="w120 mprice">
									<span class="bold ccf0 f16 danjia" id="mprice">{$vo.mprice}</span>
								</li>
								<li class="w120 num">
									<span class="lose" style="border: 1px solid white;">-</span>                   
									<input type="text" id="goods" name="goods_number" maxlength="4" size="2" value="{$vo.num}" class="b_1_e5e p_0_5 tc w28 h20 ie-t1_m50 ie_mi goods_number c000 bold" oprid="548546" oprnum="1">
									<span class="aaa" style="border: 1px solid white;">+</span>
								</li>




								<li class="w100 tr">
									<a href="" id="collection" oprid="25523" class="ul">收藏</a>
									<a href="{:U('Car/delete',array('id'=>$vo['id']))}" data="548546" class="ul delete">删除</a>
									
									<input class="ids checkbox_child" type="checkbox" name="id[]" value="{$vo.id}">
								</li>               </ul>
								</volist>

							<ul class="bt_1_eae bb_1_fff"></ul>


							<!-- Cale 2014-03-13-->



							<div class="clear"></div>
						</div>
						
						<div class="w930 m0a">
							<div class="fl">
								<div class="mt50">
									<a href="/index.php/Home/Index/index.html" class="f14 bold c999 b_1_efe btnf7f w146 h40 fl tc">继续购物</a>
								</div>
							</div>
							<div class="fr">
								<div class="tc cd00 mt20">
									<span class="f13 bold">商品总额：￥</span>
									<span class="f20 jianqiangzong" id="goods_amount">0</span>
								</div>

								<div class="mt20 tr">
									<input  type="submit" class="btnd00 w146 h40 f16 bold "  value="去结算">
								</div>

							</div>
						</div>
						</form>
    </div>
</div>
				<!--为你推荐-->
				<div class="guesslike_div">
					<div class="remat">
						<div class="d_h2">
							<ul>
                                <li class="on">猜你喜欢</li>
                            </ul>
						</div>
						<div class="detail_l_con4">
							<div class="noguess">暂无商品向您推荐</div>
						</div>
					</div>
				</div>
				<!--为你推荐-->
			</div>
		</div>
		</block>
		<!--tipend-->
		<!--底部公用-->
		<block name="sidebar"></block>
	<block name="script">
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script type="text/javascript">
    $(function(){
      $('li span.aaa').click(function(){
        var index = $('li span.aaa').index($(this));
        // alert(index); 
            var x=$('input[id=goods]').eq(index).val();
            var id=$('input[name=id]').eq(index).val();
             //alert(id);
                x++;
            var r = /^[0-9]*[1-9][0-9]*$/;
                if(!r.test(x)){
                    x=Math.ceil(x);
                }
                var c =$('li span#mprice').index($(this));

                var count=Number($('#goods_amount').html());
                var price=Number($('li span#mprice').eq(c).html());
                 
                $('#goods_amount').html(count+price);


                $('input[id=goods]').eq(index).val(x);
            $.post("{:U('Car/update')}", { x: x ,id:id},
                    function(data){
                         
                    });
               
        });

      $('li span.lose').click(function(){
        var index = $('li span.lose').index($(this));
        var id=$('input[name=id]').eq(index).val();
         //alert(id);

            var x=$('input[id=goods]').eq(index).val();
                x--;
            var r = /^[0-9]*[1-9][0-9]*$/;
                if(x<1){
                    x=1
                }
                if(!r.test(x)){
                    x=Math.ceil(x);
                }
                var c =$('li span#mprice').index($(this));

                var count=Number($('#goods_amount').html());
                var price=Number($('li span#mprice').eq(c).html());
                if (x!=1) {
                $('#goods_amount').html(count-price);
                  }
                $('input[id=goods]').eq(index).val(x);
            $.post("{:U('Car/update')}", { x: x,id:id },
                    function(data){
                         
                    });

        });

                


        //  $('.check-all').click(function(){
        //      $("input[type=checkbox]").attr("checked","true");
        // });

        // $(".check-all").click(function(){
            
        //     $("input[type='checkbox']").attr("checked",this.checked);
        //     });
  
        //     $("input[type='checkbox']").click(function(){
        //         var flag=true;
                
        //     $("input[type='checkbox']").each(function(){
        //         if(!this.checked){
        //             flag=false;
        //             // alert(flag);
        //         }
        //     });
        //         $(".check-all").attr("checked",flag);
        //     })

            var unitprice_zong = 0; //总价
			var childL = 0; //个数
			var zonggong=0;
            
			$(".checkbox_child").click(function(){
			    var index = $(".checkbox_child").index($(this));
				var num = $("input[name=goods_number]").eq(index).val();
				var price = $(".danjia").eq(index).text();
				var total = num*price;
				if($(this).is(":checked")){
					zonggong+=total;
				}else{
					zonggong-=total;
				}
				// console.log(zonggong);
                $('.settlement_a').css('background', 'red');
				$("#goods_amount").html(zonggong);
			})

			$('.checkbox_all').click(function(){
				if ($(this).is(":checked")) {
				// 全选
				$('.checkbox_child').prop("checked", true);
				// 全选改变结算背景色
				$('.settlement_a').css('background', 'red');
				// $('.checkbox_child').each(function() {
				
				var i = $(".checkbox_all").index($(this));
				var num = $("input[name=goods_number]").eq(i).val();
				var price = $(".danjia").eq(i).text();
				// var total += num*price;
				   console.log(i);
				// });
				$("#goods_amount").html(zonggong);

			} else {
			// 全不选
			$('.checkbox_child').prop("checked", false);
			// 按钮变色
			$('.settlement_a').css('background', 'rgba(232,170,59,1)');
			// 总个数
			// childL = 0;
			// $('.number_geshu').text(childL);
			// 计算总价
			unitprice_zong = 0;
			$('.jianqiangzong').text(unitprice_zong);
		}
	});



    });
</script>
</block>    


